package com.actionscriptclass
{
 
	import com.actionscriptclass.dataholder.RegisterData;
    
    public class RegisterTimer extends MainTimer
	{
 
      public function RegisterTimer(delay:uint,repeat:uint=0)
	  {    
	    _mainData=new RegisterData(delay,repeat);
	     //_setState update TimerInvoker with new data every time when user add new data to RegisterTimer
	    //that is the reason why RegisterData and TimerInvoker are in _setState.
	    _setState.setDataHolder(_mainData);
      }
			
	   public function addItem(linkage:String,element:*,array:Array):void
	   { 
	   	  var dataObject:Object = new Object();
	 	  var dataArray:Array = new Array();
	   	  for(var i:uint=0;i<array.length;i++)
	   	  {
	   	  	 dataArray.push(array[i]) ;
	   	  }
	   	    dataObject['linkage']=linkage
	   	    dataObject['object']=element;
	   	    dataObject['array']=dataArray;
	   	    dataObject['arrayLenght']=dataArray.length;
	       _setState.setData( dataObject);
	    }
		
		 	 
	  
	 	
	 	public function getValue(linkage:String,prop:String,iteration:uint=0 ):*
	    {
	    	return _mainData.dataHolderData.getValue(linkage ,prop ,iteration )
	    }
	 	 
	 	override public function loop( loopNumber:uint=1 ):void
		{
 			 
		}
		
		public function length(linkage:String):uint
		{
			 return _mainData.dataHolderData.getLenght(linkage)//_mainData.dataLenght()
		}
	 	 
	 	public function reset():void
	 	{
	 		 _mainData.dataHolderData.resetDataHolder();
	 	}

	}
}